package com.nondo.rdp.finance.domain.analysis;

import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;
import com.nondo.rdp.core.domain.attach.Attach;

import javax.persistence.*;

/**
 * 金融圈-分析-收藏
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "analysis_collection")
public class AnalysisCollection extends BaseEntity {
    private Long id;        //自增ID
    private Analysis analysis;  //收藏的分析
    private User user;      //收藏的用户
    private String title;   //分析标题
    private Attach image;   //分析图片

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "aid")
    public Analysis getAnalysis() {
        return analysis;
    }

    public void setAnalysis(Analysis analysis) {
        this.analysis = analysis;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "uid")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Column(name = "title", length = 255)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "image")
    public Attach getImage() {
        return image;
    }

    public void setImage(Attach image) {
        this.image = image;
    }
}
